package study.cell_game.objects;

import org.andengine.entity.sprite.Sprite;
import org.andengine.input.touch.TouchEvent;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;

import study.cell_game.enums.Direction;
import study.cell_game.utils.TapManager;

public class ArrowSprite extends Sprite {
	//private Token cell;
	private Direction dir;
	public ArrowSprite(float pX, float pY, ITextureRegion pTextureRegion,
			VertexBufferObjectManager VertexBufferObjectManager, Direction dir) {
		super(pX, pY, pTextureRegion, VertexBufferObjectManager);
		this.dir = dir;
		this.oldBlue = this.getBlue();
		//this.cell = cell;
	}

	@Override
	public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
		if (TouchEvent.ACTION_DOWN == (pSceneTouchEvent.getAction())) {
			//TapManager.getInstance().tapArrow(this);
		}
		//if(cell.isMapCell()){
//			if (TouchEvent.ACTION_DOWN == (pSceneTouchEvent.getAction())) {
//				if(cell.getToken() != null){
//					cell.getToken().getPlayerColor().onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
//				} else {
//					TapManager.getInstance().tapCell(this);
//				}
//			}
		//}
		return true;
	}
	
	private float oldBlue;
	
	public Direction getDir(){
		return this.dir;
	}
	//public Cell getCell() {
	//	return this.cell;
	//}

	public void resetBlue() {
		this.setBlue(oldBlue);
	}
}
